﻿using FluentNHibernate.Mapping;
using SimpleScrum.Core.Entities;

namespace SimpleScrum.Core.Mappings
{
    public class TeamMemberMap : ClassMap<TeamMember>
    {
        public TeamMemberMap()
        {
            Table("TeamMember");
            LazyLoad();
            Id(x => x.Id).Column("ID").GeneratedBy.GuidComb();
            References(x => x.Users).Column("UsersId").Cascade.All();
            References(x => x.Team).Column("TeamId").Cascade.All();
            HasMany(m => m.UsersList).KeyColumn("UsersId").AsList(l => l.Column("UsersIndex"));
        }
    }
}